#include "logingdlg.h"
#include "ui_logingdlg.h"

LogingDlg::LogingDlg(QWidget* parent) :
	QDialog(parent),
	ui(new Ui::LogingDlg)
{
	ui->setupUi(this);
	m_dAddUser = new AddUserDlg(this);
	m_dAddUser->hide();
	ui->tableWidget->setColumnCount(3);
}

LogingDlg::~LogingDlg()
{
	delete ui;
}

void LogingDlg::serachUserData()
{
	m_dAddUser->m_db.selectData();
	int size = m_dAddUser->m_db.m_cDatas.size();

	ui->tableWidget->setRowCount(size);
	for (int row = 0; row < size; row++)
	{
		ui->tableWidget->setItem(row, 0, new QTableWidgetItem(QString::number(m_dAddUser->m_db.m_cDatas[row].nId)));
		ui->tableWidget->setItem(row, 1, new QTableWidgetItem(m_dAddUser->m_db.m_cDatas[row].strName));
		ui->tableWidget->setItem(row, 2, new QTableWidgetItem(QString::number(m_dAddUser->m_db.m_cDatas[row].nLevel)));
	}
}

void LogingDlg::on_Add_Bt_clicked()
{
	m_dAddUser->show();
}


void LogingDlg::on_Delete_Bt_clicked()
{

}
